package com.lfy.yunpicture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.lfy.yunpicture.model.dto.space.SpaceAddRequest;
import com.lfy.yunpicture.model.dto.space.SpaceQueryRequest;
import com.lfy.yunpicture.model.entity.Space;
import com.lfy.yunpicture.model.entity.User;
import com.lfy.yunpicture.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 空间服务
 *
*/
public interface SpaceService extends IService<Space> {

    /**
     * 校验数据
     *
     * @param space
     * @param add 对创建的数据进行校验
     */
    void validSpace(Space space, boolean add);

    /**
     * 获取查询条件
     *
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);
    
    /**
     * 获取空间封装
     *
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 分页获取空间封装
     *
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);
    /**
     * 删除空间
     */
    boolean deleteSpace(Long id, HttpServletRequest request);
    /**
     * 创建空间
     */
    Long addSpace(SpaceAddRequest spaceAddRequest, HttpServletRequest request);

    List<SpaceVO> listMySpaceVO(User loginUser);
}
